<template>
  <div class="invoice-container">
    <el-steps :active="stepsActive" simple finish-status="success">
      <template v-for="(item, index) in steps">
        <el-step
          class="step"
          :key="index"
          :title="item.title"
          :icon="item.icon"
        ></el-step>
      </template>
    </el-steps>

    <!-- 路由占位符 -->
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      stepsActive: 0,
      steps: [
        {
          title: "基本信息",
          icon: "el-icon-mobile-phone",
          path: "/register-phone",
        },
        {
          title: "选择类型",
          icon: "el-icon-thumb",
          path: "/select-type",
        },
        {
          title: "信息登记",
          icon: "el-icon-edit-outline",
          path: "/business-info",
        },
        {
          title: "客户信息",
          icon: "el-icon-circle-check",
          path: "/merchant-info",
        },
      ],
    };
  },
  created() {},
  watch: {
    // 如果路由有变化，会再次执行该方法
    $route: "stepChange",
  },
  methods: {
    stepChange() {
      this.stepsActive = this.steps.findIndex(
        (v) => v.title === this.$route.name
      );
    },
  },
};
</script>

<style lang="less" scoped>
.el-step__title.is-finish {
  color: #22819d;
}
.invoice-instructions {
  .el-card__header {
    border: none !important;
  }
  .title {
    font-size: 1rem;
  }
  width: 100%;
  color: #22819d;
  background-color: #f2fcff;
  margin-bottom: 20px;
  margin-top: 10px;
  border: none;
  padding-left: 2rem;
}
</style>
